
<!DOCTYPE html>


<html lang="zh-CN" data-content_root="./" >

  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
    <link href="_static/taiji.png" sizes="360x360" rel="icon" type="image/png">
    <title>五行 &#8212; YiJingFramework. PrimitiveTypes</title>
  
  
  
  <script data-cfasync="false">
    document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
    document.documentElement.dataset.theme = localStorage.getItem("theme") || "light";
  </script>
  
  <!-- Loaded before other Sphinx assets -->
  <link href="_static/styles/theme.css?digest=8d27b9dea8ad943066ae" rel="stylesheet" />
<link href="_static/styles/bootstrap.css?digest=8d27b9dea8ad943066ae" rel="stylesheet" />
<link href="_static/styles/pydata-sphinx-theme.css?digest=8d27b9dea8ad943066ae" rel="stylesheet" />

  
  <link href="_static/vendor/fontawesome/6.5.1/css/all.min.css?digest=8d27b9dea8ad943066ae" rel="stylesheet" />
  <link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.5.1/webfonts/fa-solid-900.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.5.1/webfonts/fa-brands-400.woff2" />
<link rel="preload" as="font" type="font/woff2" crossorigin href="_static/vendor/fontawesome/6.5.1/webfonts/fa-regular-400.woff2" />

    <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=72bcf2f2" />
    <link rel="stylesheet" type="text/css" href="_static/styles/sphinx-book-theme.css?v=384b581d" />
    <link rel="stylesheet" type="text/css" href="_static/nbsphinx-code-cells.css" />
  
  <!-- Pre-loaded scripts that we'll load fully later -->
  <link rel="preload" as="script" href="_static/scripts/bootstrap.js?digest=8d27b9dea8ad943066ae" />
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae" />
  <script src="_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=8d27b9dea8ad943066ae"></script>

    <script src="_static/documentation_options.js?v=946197a6"></script>
    <script src="_static/doctools.js?v=888ff710"></script>
    <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="_static/scripts/sphinx-book-theme.js?v=efea14e4"></script>
    <script src="_static/translations.js?v=beaddf03"></script>
    <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
    <script>window.MathJax = {"tex": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true}, "options": {"ignoreHtmlClass": "tex2jax_ignore|mathjax_ignore|document", "processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}</script>
    <script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
    <script>DOCUMENTATION_OPTIONS.pagename = '五行';</script>
    <link rel="index" title="索引" href="genindex.html" />
    <link rel="search" title="搜索" href="search.html" />
    <link rel="next" title="天干地支" href="%E5%A4%A9%E5%B9%B2%E5%9C%B0%E6%94%AF.html" />
    <link rel="prev" title="简介" href="%E7%AE%80%E4%BB%8B.html" />
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
  <meta name="docsearch:language" content="zh-CN"/>
  </head>
  
  
  <body data-bs-spy="scroll" data-bs-target=".bd-toc-nav" data-offset="180" data-bs-root-margin="0px 0px -60%" data-default-mode="">

  
  
  <a id="pst-skip-link" class="skip-link" href="#main-content">Skip to main content</a>
  
  <div id="pst-scroll-pixel-helper"></div>
  
  <button type="button" class="btn rounded-pill" id="pst-back-to-top">
    <i class="fa-solid fa-arrow-up"></i>
    Back to top
  </button>

  
  <input type="checkbox"
          class="sidebar-toggle"
          name="__primary"
          id="__primary"/>
  <label class="overlay overlay-primary" for="__primary"></label>
  
  <input type="checkbox"
          class="sidebar-toggle"
          name="__secondary"
          id="__secondary"/>
  <label class="overlay overlay-secondary" for="__secondary"></label>
  
  <div class="search-button__wrapper">
    <div class="search-button__overlay"></div>
    <div class="search-button__search-container">
<form class="bd-search d-flex align-items-center"
      action="search.html"
      method="get">
  <i class="fa-solid fa-magnifying-glass"></i>
  <input type="search"
         class="form-control"
         name="q"
         id="search-input"
         placeholder="Search..."
         aria-label="Search..."
         autocomplete="off"
         autocorrect="off"
         autocapitalize="off"
         spellcheck="false"/>
  <span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span>
</form></div>
  </div>
  
    <header class="bd-header navbar navbar-expand-lg bd-navbar">
    </header>
  

  <div class="bd-container">
    <div class="bd-container__inner bd-page-width">
      
      
      
      <div class="bd-sidebar-primary bd-sidebar">
        

  
  <div class="sidebar-header-items sidebar-primary__section">
    
    
    
    
  </div>
  
    <div class="sidebar-primary-items__start sidebar-primary__section">
        <div class="sidebar-primary-item">

  

<a class="navbar-brand logo" href="index.html">
  
  
  
  
  
  
    <p class="title logo__title">YiJingFramework. PrimitiveTypes</p>
  
</a></div>
        <div class="sidebar-primary-item">

 <script>
 document.write(`
   <button class="btn navbar-btn search-button-field search-button__button" title="搜索" aria-label="搜索" data-bs-placement="bottom" data-bs-toggle="tooltip">
    <i class="fa-solid fa-magnifying-glass"></i>
    <span class="search-button__default-text">搜索</span>
    <span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span>
   </button>
 `);
 </script></div>
        <div class="sidebar-primary-item"><nav class="bd-links bd-docs-nav" aria-label="Main">
    <div class="bd-toc-item navbar-nav active">
        <p aria-level="2" class="caption" role="heading"><span class="caption-text">主要页面</span></p>
<ul class="current nav bd-sidenav">
<li class="toctree-l1"><a class="reference internal" href="%E7%AE%80%E4%BB%8B.html">简介</a></li>
<li class="toctree-l1 current active"><a class="current reference internal" href="#">五行</a></li>
<li class="toctree-l1"><a class="reference internal" href="%E5%A4%A9%E5%B9%B2%E5%9C%B0%E6%94%AF.html">天干地支</a></li>
<li class="toctree-l1"><a class="reference internal" href="%E9%98%B4%E9%98%B3.html">阴阳</a></li>
<li class="toctree-l1"><a class="reference internal" href="%E5%8D%A6.html">卦</a></li>
</ul>

    </div>
</nav></div>
    </div>
  
  
  <div class="sidebar-primary-items__end sidebar-primary__section">
  </div>
  
  <div id="rtd-footer-container"></div>


      </div>
      
      <main id="main-content" class="bd-main">
        
        

<div class="sbt-scroll-pixel-helper"></div>

          <div class="bd-content">
            <div class="bd-article-container">
              
              <div class="bd-header-article">
<div class="header-article-items header-article__inner">
  
    <div class="header-article-items__start">
      
        <div class="header-article-item"><label class="sidebar-toggle primary-toggle btn btn-sm" for="__primary" title="Toggle primary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
  <span class="fa-solid fa-bars"></span>
</label></div>
      
    </div>
  
  
    <div class="header-article-items__end">
      
        <div class="header-article-item">

<div class="article-header-buttons">


<a href="https://github.com/YiJingFramework/PrimitiveTypes.git" target="_blank"
   class="btn btn-sm btn-source-repository-button"
   title="源码库"
   data-bs-placement="bottom" data-bs-toggle="tooltip"
>
  

<span class="btn__icon-container">
  <i class="fab fa-github"></i>
  </span>

</a>






<div class="dropdown dropdown-download-buttons">
  <button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="下载此页面">
    <i class="fas fa-download"></i>
  </button>
  <ul class="dropdown-menu">
      
      
      
      <li><a href="_sources/五行.ipynb" target="_blank"
   class="btn btn-sm btn-download-source-button dropdown-item"
   title="下载源文件"
   data-bs-placement="left" data-bs-toggle="tooltip"
>
  

<span class="btn__icon-container">
  <i class="fas fa-file"></i>
  </span>
<span class="btn__text-container">.ipynb</span>
</a>
</li>
      
      
      
      
      <li>
<button onclick="window.print()"
  class="btn btn-sm btn-download-pdf-button dropdown-item"
  title="列印成 PDF"
  data-bs-placement="left" data-bs-toggle="tooltip"
>
  

<span class="btn__icon-container">
  <i class="fas fa-file-pdf"></i>
  </span>
<span class="btn__text-container">.pdf</span>
</button>
</li>
      
  </ul>
</div>




<button onclick="toggleFullScreen()"
  class="btn btn-sm btn-fullscreen-button"
  title="全屏模式"
  data-bs-placement="bottom" data-bs-toggle="tooltip"
>
  

<span class="btn__icon-container">
  <i class="fas fa-expand"></i>
  </span>

</button>



<script>
document.write(`
  <button class="btn btn-sm navbar-btn theme-switch-button" title="light/dark" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip">
    <span class="theme-switch nav-link" data-mode="light"><i class="fa-solid fa-sun fa-lg"></i></span>
    <span class="theme-switch nav-link" data-mode="dark"><i class="fa-solid fa-moon fa-lg"></i></span>
    <span class="theme-switch nav-link" data-mode="auto"><i class="fa-solid fa-circle-half-stroke fa-lg"></i></span>
  </button>
`);
</script>


<script>
document.write(`
  <button class="btn btn-sm navbar-btn search-button search-button__button" title="搜索" aria-label="搜索" data-bs-placement="bottom" data-bs-toggle="tooltip">
    <i class="fa-solid fa-magnifying-glass fa-lg"></i>
  </button>
`);
</script>
<label class="sidebar-toggle secondary-toggle btn btn-sm" for="__secondary"title="Toggle secondary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
    <span class="fa-solid fa-list"></span>
</label>
</div></div>
      
    </div>
  
</div>
</div>
              
              

<div id="jb-print-docs-body" class="onlyprint">
    <h1>五行</h1>
    <!-- Table of contents -->
    <div id="print-main-content">
        <div id="jb-print-toc">
            
            <div>
                <h2> 目录 </h2>
            </div>
            <nav aria-label="Page">
                <ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#获取">获取</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#Wuxing-和-string-的相互转换">Wuxing 和 string 的相互转换</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#Wuxing-和-int-的相互转换">Wuxing 和 int 的相互转换</a></li>
</ul>
            </nav>
        </div>
    </div>
</div>

              
                
<div id="searchbox"></div>
                <article class="bd-article">
                  
  <section id="五行">
<h1>五行<a class="headerlink" href="#五行" title="Link to this heading">#</a></h1>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[1]:
</pre></div>
</div>
<div class="input_area highlight-csharp notranslate"><div class="highlight"><pre><span></span><span class="err">#</span><span class="n">r</span><span class="w"> </span><span class="s">&quot;nuget:ConsoleTables&quot;</span>
<span class="err">#</span><span class="n">r</span><span class="w"> </span><span class="s">&quot;nuget:YiJingFramework.PrimitiveTypes&quot;</span>
<span class="k">using</span><span class="w"> </span><span class="nn">ConsoleTables</span><span class="p">;</span>
<span class="k">using</span><span class="w"> </span><span class="nn">YiJingFramework.PrimitiveTypes</span><span class="p">;</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area rendered_html docutils container">
<div><div></div><div></div><div><strong>Installed Packages</strong><ul><li><span>ConsoleTables, 2.6.1</span></li><li><span>YiJingFramework.PrimitiveTypes, 4.0.1</span></li></ul></div></div></div>
</div>
<p>类型 <code class="docutils literal notranslate"><span class="pre">Wuxing</span></code> 表示五行木、火、土、金、水。它可以与 <code class="docutils literal notranslate"><span class="pre">string</span></code> 、 <code class="docutils literal notranslate"><span class="pre">int</span></code> 之间进行相互转化，实现了 <code class="docutils literal notranslate"><span class="pre">IComparable</span></code> 、 <code class="docutils literal notranslate"><span class="pre">IEquatable</span></code> 和 <code class="docutils literal notranslate"><span class="pre">IEqualityOperators</span></code> 等接口，可以正确地支持排序和比较等行为，支持使用 <code class="docutils literal notranslate"><span class="pre">==</span></code> 等运算符进行比较。</p>
<section id="获取">
<h2>获取<a class="headerlink" href="#获取" title="Link to this heading">#</a></h2>
<p><code class="docutils literal notranslate"><span class="pre">Wuxing</span></code> 中提供了静态属性以直接获取特定五行：</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[2]:
</pre></div>
</div>
<div class="input_area highlight-csharp notranslate"><div class="highlight"><pre><span></span><span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">$&quot;{Wuxing.Mu} {Wuxing.Huo:C} {Wuxing.Tu} {Wuxing.Jin:C} {Wuxing.Shui}&quot;</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
Mu 火 Tu 金 Shui
</pre></div></div>
</div>
</section>
<section id="Wuxing-和-string-的相互转换">
<h2>Wuxing 和 string 的相互转换<a class="headerlink" href="#Wuxing-和-string-的相互转换" title="Link to this heading">#</a></h2>
<p>上例已经显示了可以使用 <code class="docutils literal notranslate"><span class="pre">Wuxing.ToString</span></code> 将其转为中文或英文的字符串形式，这边给出一个完整的表格：</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[3]:
</pre></div>
</div>
<div class="input_area highlight-csharp notranslate"><div class="highlight"><pre><span></span><span class="n">Wuxing</span><span class="p">[]</span><span class="w"> </span><span class="n">wuxings</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="n">Wuxing</span><span class="p">.</span><span class="n">Mu</span><span class="p">,</span><span class="w"> </span><span class="n">Wuxing</span><span class="p">.</span><span class="n">Huo</span><span class="p">,</span><span class="w"> </span><span class="n">Wuxing</span><span class="p">.</span><span class="n">Tu</span><span class="p">,</span><span class="w"> </span><span class="n">Wuxing</span><span class="p">.</span><span class="n">Jin</span><span class="p">,</span><span class="w"> </span><span class="n">Wuxing</span><span class="p">.</span><span class="n">Shui</span><span class="p">];</span>
<span class="kt">var</span><span class="w"> </span><span class="n">table</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">ConsoleTable</span><span class="p">(</span><span class="s">&quot;Wuxing&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;G&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;C&quot;</span><span class="p">);</span>
<span class="k">foreach</span><span class="w"> </span><span class="p">(</span><span class="kt">var</span><span class="w"> </span><span class="n">wuxing</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">wuxings</span><span class="p">)</span>
<span class="w">    </span><span class="n">table</span><span class="p">.</span><span class="n">AddRow</span><span class="p">(</span><span class="s">$&quot;Wuxing.{wuxing}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">wuxing</span><span class="p">.</span><span class="n">ToString</span><span class="p">(</span><span class="s">&quot;G&quot;</span><span class="p">),</span><span class="w"> </span><span class="n">wuxing</span><span class="p">.</span><span class="n">ToString</span><span class="p">(</span><span class="s">&quot;C&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="p">.</span><span class="n">Write</span><span class="p">(</span><span class="n">Format</span><span class="p">.</span><span class="n">Minimal</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
| Wuxing      | G    | C  |
|-------------|------|----|
| Wuxing.Mu   | Mu   | 木 |
| Wuxing.Huo  | Huo  | 火 |
| Wuxing.Tu   | Tu   | 土 |
| Wuxing.Jin  | Jin  | 金 |
| Wuxing.Shui | Shui | 水 |

</pre></div></div>
</div>
<blockquote>
<div><p>其他语言不会在这个包中支持，不过自己实现一个方法也是相对方便的，也可以借助 <a class="reference external" href="https://yjfwk.yueyinqiu.top/EntityRelations/">YiJingFramework.EntityRelations</a> 提供的扩展方法加以支持。</p>
</div></blockquote>
<p>若要从字符串转换到五行，可以使用 <code class="docutils literal notranslate"><span class="pre">Parse</span></code> 或 <code class="docutils literal notranslate"><span class="pre">TryParse</span></code> 方法，其表现和 <code class="docutils literal notranslate"><span class="pre">int</span></code>、<code class="docutils literal notranslate"><span class="pre">double</span></code> 等内置类型基本一致，支持上述所有转换结果，不区分大小写，允许前后有空白字符：</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[4]:
</pre></div>
</div>
<div class="input_area highlight-csharp notranslate"><div class="highlight"><pre><span></span><span class="n">Console</span><span class="p">.</span><span class="n">Write</span><span class="p">(</span><span class="n">Wuxing</span><span class="p">.</span><span class="n">Parse</span><span class="p">(</span><span class="s">&quot;木 &quot;</span><span class="p">));</span>
<span class="n">Console</span><span class="p">.</span><span class="n">Write</span><span class="p">(</span><span class="n">Wuxing</span><span class="p">.</span><span class="n">Parse</span><span class="p">(</span><span class="s">&quot;hUO&quot;</span><span class="p">));</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
MuHuo
</pre></div></div>
</div>
</section>
<section id="Wuxing-和-int-的相互转换">
<h2>Wuxing 和 int 的相互转换<a class="headerlink" href="#Wuxing-和-int-的相互转换" title="Link to this heading">#</a></h2>
<p>在 <code class="docutils literal notranslate"><span class="pre">Wuxing</span></code> 和 <code class="docutils literal notranslate"><span class="pre">int</span></code> 之间可以使用强制类型转换，其具体效果如下表：</p>
<div class="nbinput docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>[5]:
</pre></div>
</div>
<div class="input_area highlight-csharp notranslate"><div class="highlight"><pre><span></span><span class="kt">var</span><span class="w"> </span><span class="n">numbers</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Enumerable</span><span class="p">.</span><span class="n">Range</span><span class="p">(</span><span class="m">0</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="m">2</span><span class="p">,</span><span class="w"> </span><span class="m">5</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="m">4</span><span class="p">);</span>
<span class="kt">var</span><span class="w"> </span><span class="n">table</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">ConsoleTable</span><span class="p">(</span><span class="s">&quot;i&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;w = (Wuxing)i&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;(int)w&quot;</span><span class="p">);</span>
<span class="k">foreach</span><span class="w"> </span><span class="p">(</span><span class="kt">var</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">numbers</span><span class="p">)</span>
<span class="p">{</span>
<span class="w">    </span><span class="kt">var</span><span class="w"> </span><span class="n">w</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">Wuxing</span><span class="p">)</span><span class="n">i</span><span class="p">;</span>
<span class="w">    </span><span class="kt">var</span><span class="w"> </span><span class="n">newI</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">w</span><span class="p">;</span>
<span class="w">    </span><span class="kt">var</span><span class="w"> </span><span class="n">star</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">newI</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">?</span><span class="w"> </span><span class="sc">&#39; &#39;</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="sc">&#39;*&#39;</span><span class="p">;</span>
<span class="w">    </span><span class="n">table</span><span class="p">.</span><span class="n">AddRow</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="w"> </span><span class="s">$&quot;{star}{w:C} {w}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">newI</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">table</span><span class="p">.</span><span class="n">Write</span><span class="p">(</span><span class="n">Format</span><span class="p">.</span><span class="n">Minimal</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="nboutput nblast docutils container">
<div class="prompt empty docutils container">
</div>
<div class="output_area docutils container">
<div class="highlight"><pre>
| i  | w = (Wuxing)i | (int)w |
|----|---------------|--------|
| -2 | *金 Jin       | 3      |
| -1 | *水 Shui      | 4      |
| 0  |  木 Mu        | 0      |
| 1  |  火 Huo       | 1      |
| 2  |  土 Tu        | 2      |
| 3  |  金 Jin       | 3      |
| 4  |  水 Shui      | 4      |
| 5  | *木 Mu        | 0      |
| 6  | *火 Huo       | 1      |

</pre></div></div>
</div>
<p>这种转换一般情况下是不建议使用的，因为它并没有直接的实际意义。它主要是用于在数学上计算获取生克之类，以及便于通过 <code class="docutils literal notranslate"><span class="pre">switch</span></code> 进行匹配。其提供的运算符 <code class="docutils literal notranslate"><span class="pre">+</span></code> 和 <code class="docutils literal notranslate"><span class="pre">-</span></code> 也是如此。</p>
</section>
</section>


                </article>
              

              
              
              
              
                <footer class="prev-next-footer">
                  
<div class="prev-next-area">
    <a class="left-prev"
       href="%E7%AE%80%E4%BB%8B.html"
       title="previous page">
      <i class="fa-solid fa-angle-left"></i>
      <div class="prev-next-info">
        <p class="prev-next-subtitle">上一页</p>
        <p class="prev-next-title">简介</p>
      </div>
    </a>
    <a class="right-next"
       href="%E5%A4%A9%E5%B9%B2%E5%9C%B0%E6%94%AF.html"
       title="next page">
      <div class="prev-next-info">
        <p class="prev-next-subtitle">下一页</p>
        <p class="prev-next-title">天干地支</p>
      </div>
      <i class="fa-solid fa-angle-right"></i>
    </a>
</div>
                </footer>
              
            </div>
            
            
              
                <div class="bd-sidebar-secondary bd-toc"><div class="sidebar-secondary-items sidebar-secondary__inner">


  <div class="sidebar-secondary-item">
  <div class="page-toc tocsection onthispage">
    <i class="fa-solid fa-list"></i> 目录
  </div>
  <nav class="bd-toc-nav page-toc">
    <ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#获取">获取</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#Wuxing-和-string-的相互转换">Wuxing 和 string 的相互转换</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#Wuxing-和-int-的相互转换">Wuxing 和 int 的相互转换</a></li>
</ul>
  </nav></div>

</div></div>
              
            
          </div>
          <footer class="bd-footer-content">
            
<div class="bd-footer-content__inner container">
  
  <div class="footer-item">
    
  </div>
  
  <div class="footer-item">
    

  </div>
  
  <div class="footer-item">
    
  </div>
  
  <div class="footer-item">
    
<div class="extra_footer">
  这里是 YiJingFramework.PrimitiveTypes 的文档。前往 <a href="https://yjfwk.yueyinqiu.top/">https://yjfwk.yueyinqiu.top/</a> 查看更多项目。
</div>
  </div>
  
</div>
          </footer>
        

      </main>
    </div>
  </div>
  
  <!-- Scripts loaded after <body> so the DOM is not blocked -->
  <script src="_static/scripts/bootstrap.js?digest=8d27b9dea8ad943066ae"></script>
<script src="_static/scripts/pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae"></script>

  <footer class="bd-footer">
  </footer>
  </body>
</html>